<template>
  <body>
    <div id="login">
      <div class="native">
        <div class="title">
          <img src="../../assets/Logo.jpeg" alt="logo" />
          <h2>高考志愿填报智能辅助系统</h2>
        </div>
        <div class="exit">
          <router-link href="#" to="/">返回首页</router-link>
        </div>
      </div>
      <div class="loginArea">
        <div class="chooseWay">
          <router-link
            to="/login/accountLogin"
            class="oldStyle"
            :class="active === 0 ? 'newStyle' : ''"
          >
            <span @click="change">账号登录</span>
          </router-link>
          <router-link
            to="/login/emailLogin"
            class="oldStyle"
            :class="active === 1 ? 'newStyle' : ''"
          >
            <span @click="change">邮箱登录</span>
          </router-link>
        </div>
        <div class="router">
          <router-view></router-view>
        </div>
      </div>
    </div>
  </body>
</template>

<script>
export default {
  name: "Login",
  data() {
    return {
      // 判断是否切换样式
      active: 0,
    };
  },
  methods: {
    // 选择登录方式 切换样式
    change() {
      if (this.active === 0) {
        this.active = 1;
        console.log(this.active);
      } else {
        this.active = 0;
      }
    },
  },
};
</script>

<style scoped>
body {
  width: 100%;
  height: 100%;
  font-size: 18px;
  position: fixed;
  background: url("../../assets/LoginBack.jpg") no-repeat;
  background-position: center;
  background-size: cover;
}

a {
  color: #666;
}

.native {
  width: 100%;
  height: 120px;
  display: flex;
  flex-direction: row;
}

.title {
  position: relative;
  width: 500px;
  height: 100px;
  line-height: 100px;
  margin-top: 30px;
  left: 50%;
  margin-left: -150px;
  text-align: center;
}

.title img {
  float: left;
  width: 40px;
  padding-top: 30px;
}

.title h2 {
  float: left;
  margin-left: 15px;
  height: 100px;
  line-height: 100px;
  font-size: 24px;
}

.exit {
  width: 100px;
  position: absolute;
  top: 50px;
  right: 100px;
  font-size: 18px;
  cursor: pointer;
}

#login {
  font-size: 16px;
}

.loginArea {
  position: relative;
  width: 510px;
  height: 350px;
  margin: 20px auto;
}

.chooseWay {
  position: absolute;
  width: 260px;
  height: 60px;
  line-height: 60px;
  left: 50%;
  margin-left: -130px;
}

.chooseWay .oldStyle {
  display: inline-block;
  height: 100%;
  width: 120px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
}

.chooseWay .oldStyle:hover {
  color: rgba(255, 101, 0);
  border-bottom: 2px solid rgba(255, 101, 0);
  cursor: pointer;
}

.newStyle {
  color: rgba(255, 101, 0);
  border-bottom: 2px solid rgba(255, 101, 0);
  cursor: pointer;
}
</style>
